package cn.iocoder.lw.module.core.controller.admin.workorder.vo.report;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 工单统计响应 VO
 */
@Schema(description = "管理后台 - 工单统计响应 VO")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WorkOrderStatisticsRespVO {

    @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long userId;

    @Schema(description = "用户姓名", requiredMode = Schema.RequiredMode.REQUIRED)
    private String userName;

    @Schema(description = "用户手机号", requiredMode = Schema.RequiredMode.REQUIRED)
    private String userMobile;

    @Schema(description = "用户类型", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer userType; // 0-接单人，1-发起人

    @Schema(description = "工单总数", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer totalWorkOrderCount;

    @Schema(description = "已完成工单数", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer completedWorkOrderCount;

    @Schema(description = "进行中工单数", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer inProgressWorkOrderCount;

    @Schema(description = "待处理工单数", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer pendingWorkOrderCount;

    @Schema(description = "已取消工单数", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer cancelledWorkOrderCount;

    @Schema(description = "工单总金额", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal totalAmount;

    @Schema(description = "平均工单金额", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal averageAmount;

    @Schema(description = "完成率", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal completionRate;

    @Schema(description = "平均处理时长（小时）", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal averageProcessHours;

    @Schema(description = "统计开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime statisticsStartTime;

    @Schema(description = "统计结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime statisticsEndTime;

    @Schema(description = "工单详情列表")
    private List<WorkOrderDetailRespVO> workOrderDetails;

    /**
     * 工单详情响应 VO
     */
    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "工单详情响应 VO")
    public static class WorkOrderDetailRespVO {

        @Schema(description = "工单ID", requiredMode = Schema.RequiredMode.REQUIRED)
        private Long id;

        @Schema(description = "工单编号", requiredMode = Schema.RequiredMode.REQUIRED)
        private String orderNo;

        @Schema(description = "项目ID")
        private Long projectId;

        @Schema(description = "房源ID")
        private Long houseId;

        @Schema(description = "设备ID")
        private Long deviceId;

        @Schema(description = "问题描述")
        private String problemDescription;

        @Schema(description = "上门时间")
        private LocalDateTime doorToDoorTime;

        @Schema(description = "工单状态")
        private Integer status;

        @Schema(description = "总费用")
        private BigDecimal totalCost;

        @Schema(description = "发起时间")
        private LocalDateTime createTime;

        @Schema(description = "完成时间")
        private LocalDateTime updateTime;

    }

}